set(LLVM_IPO_DIR ${LLVM_MAIN_SRC_DIR}/lib/Transforms/IPO)

add_llvm_component_library(LLVMBuddyIPO
  ${LLVM_IPO_DIR}/AlwaysInliner.cpp
  ${LLVM_IPO_DIR}/Annotation2Metadata.cpp
  ${LLVM_IPO_DIR}/ArgumentPromotion.cpp
  ${LLVM_IPO_DIR}/Attributor.cpp
  ${LLVM_IPO_DIR}/AttributorAttributes.cpp
  ${LLVM_IPO_DIR}/BarrierNoopPass.cpp
  ${LLVM_IPO_DIR}/BlockExtractor.cpp
  ${LLVM_IPO_DIR}/CalledValuePropagation.cpp
  ${LLVM_IPO_DIR}/ConstantMerge.cpp
  ${LLVM_IPO_DIR}/CrossDSOCFI.cpp
  ${LLVM_IPO_DIR}/DeadArgumentElimination.cpp
  ${LLVM_IPO_DIR}/ElimAvailExtern.cpp
  ${LLVM_IPO_DIR}/ExtractGV.cpp
  ${LLVM_IPO_DIR}/ForceFunctionAttrs.cpp
  ${LLVM_IPO_DIR}/FunctionAttrs.cpp
  ${LLVM_IPO_DIR}/FunctionImport.cpp
  ${LLVM_IPO_DIR}/FunctionSpecialization.cpp
  ${LLVM_IPO_DIR}/GlobalDCE.cpp
  ${LLVM_IPO_DIR}/GlobalOpt.cpp
  ${LLVM_IPO_DIR}/GlobalSplit.cpp
  ${LLVM_IPO_DIR}/HotColdSplitting.cpp
  ${LLVM_IPO_DIR}/IPO.cpp
  ${LLVM_IPO_DIR}/IROutliner.cpp
  ${LLVM_IPO_DIR}/InferFunctionAttrs.cpp
  ${LLVM_IPO_DIR}/Inliner.cpp
  ${LLVM_IPO_DIR}/Internalize.cpp
  ${LLVM_IPO_DIR}/LoopExtractor.cpp
  ${LLVM_IPO_DIR}/LowerTypeTests.cpp
  ${LLVM_IPO_DIR}/MemProfContextDisambiguation.cpp
  ${LLVM_IPO_DIR}/MergeFunctions.cpp
  ${LLVM_IPO_DIR}/ModuleInliner.cpp
  ${LLVM_IPO_DIR}/OpenMPOpt.cpp
  ${LLVM_IPO_DIR}/PartialInlining.cpp
  ${LLVM_IPO_DIR}/SampleContextTracker.cpp
  ${LLVM_IPO_DIR}/SampleProfile.cpp
  ${LLVM_IPO_DIR}/SampleProfileProbe.cpp
  ${LLVM_IPO_DIR}/SCCP.cpp
  ${LLVM_IPO_DIR}/StripDeadPrototypes.cpp
  ${LLVM_IPO_DIR}/StripSymbols.cpp
  ${LLVM_IPO_DIR}/SyntheticCountsPropagation.cpp
  ${LLVM_IPO_DIR}/ThinLTOBitcodeWriter.cpp
  ${LLVM_IPO_DIR}/WholeProgramDevirt.cpp

  ADDITIONAL_HEADER_DIRS
  ${LLVM_MAIN_INCLUDE_DIR}/llvm/Transforms
  ${LLVM_MAIN_INCLUDE_DIR}/llvm/Transforms/IPO

  DEPENDS
  buddy_intrinsics_gen
  omp_gen

  COMPONENT_NAME
  BuddyIPO

  LINK_COMPONENTS
  AggressiveInstCombine
  BuddyAnalysis
  BuddyBitReader
  BuddyBitWriter
  BuddyCore
  FrontendOpenMP
  InstCombine
  BuddyIRReader
  Linker
  BuddyObject
  Object
  BuddyProfileData
  BuddyScalar
  Support
  BuddyTransformUtils
  BuddyVectorize
  Instrumentation
  )
